<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
class PushmoneyController extends \App\Http\Controllers\AdminController{
    //put your code here
    public function index() {
        $pushmoneys = \App\Models\Pushmoney::get();
        $assign = compact('pushmoneys');
        return view('admin.pushmoney.index', $assign);
    }
    
    /**
     * 修改比例
     * @param Request $request
     * @param type $id
     * @param type $status
     * @return type
     */
    public function edit(Request $request, $id) {
        $pushmoney = \App\Models\Pushmoney::find($id);
        if ($request->ajax()) {
            $pushmoney->pidpush = $request->input('pidpush');
            $pushmoney->ppidpush = $request->input('ppidpush');
            $pushmoney->payagentpush = $request->input('payagentpush');
            $pushmoney->save();
            return \Illuminate\Support\Facades\Response::json([
                'status'    => 1,
                'info'      => '修改成功'
            ]);
        }
        $assign = compact('pushmoney');
        return view('admin.pushmoney.edit', $assign);
    }
}
